/*
 * =====================================================================================
 *
 *       Filename:  alarm.c
 *
 *    Description:  alarm of singal
 *
 *        Version:  1.0
 *        Created:  07/05/2012 06:15:46 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Liu XiaoFei (), 
 *        Company:  
 *
 * =====================================================================================
 */
#include    <stdio.h>
#include    <unistd.h>
#include    <sys/time.h>
#include    <signal.h>

void func()
{
    printf("2s reached\n");
}

int main(void)
{
    signal(SIGALRM, func);

    alarm(3);
    while(1)
        printf("Hello!\n");

    return 0;
}
